home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
setfil_1
/
fontmod.bas
< prev
next >
Wrap
BASIC Source File
|
1999-09-02
|
5KB
|
81 lines
Attribute VB_Name = "Fontmod"
Option Explicit
Public Const Top = 1 'Const for Y axis
Public Const Middle = 2 'Const for Y axis
Public Const Bottom = 3 'Const for Y axis
Public Sub Pause(HowLong As String) 'The pause, I found strings work better
Dim TheBeginning
TheBeginning = Timer
Do While Timer < TheBeginning + HowLong
DoEvents
Loop
End Sub
Sub TxtRight(Txt As String, Delay As String, Increment As Integer, YPos As Integer, PicBox As PictureBox)
Dim a As Integer, b As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = 0
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
If YPos = 1 Then 'Check to see where the user wants the text to show
PicBox.CurrentY = 0 'Top
ElseIf YPos = 2 Then 'Middle
PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
ElseIf YPos = 3 Then 'Bottom
PicBox.CurrentY = PicBox.ScaleHeight - (PicBox.TextHeight(Txt) - PicBox.FontSize) 'Bottom
End If
a% = a% + Increment% 'Add in the increment so it will move
PicBox.CurrentX = a% 'Set the X axis to what the increment has been changed to
b% = PicBox.FontSize + PicBox.TextWidth(Txt$) + PicBox.CurrentX 'Check to see where the X axis is plus the font size and text width
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
Loop Until b% >= PicBox.ScaleWidth 'Stop looping if the X axis has reached the end if the picture box
End Sub
Sub TxtLeft(Txt As String, Delay As String, Increment As Integer, YPos As Integer, PicBox As PictureBox)
Dim a As Integer, b As Integer
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
a% = PicBox.ScaleWidth - (PicBox.TextWidth(Txt) + PicBox.FontSize)
Do 'Start loop
DoEvents
PicBox.Cls 'Clear picture box
If YPos = 1 Then 'Check to see where the user wants the text to show
PicBox.CurrentY = 0 'Top
ElseIf YPos = 2 Then 'Middle
PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
ElseIf YPos = 3 Then 'Bottom
PicBox.CurrentY = PicBox.ScaleHeight - (PicBox.TextHeight(Txt) - PicBox.FontSize) 'Bottom
End If
a% = a% + Increment% 'Add in the increment so it will move
PicBox.CurrentX = a% 'Set the X axis to what the increment has been changed to
b% = PicBox.CurrentX 'Check to see where the X axis is
PicBox.Print Txt$ 'Show the text after everything has been set
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
Loop Until b% <= 0 'Stop looping if the X axis is at the beginning of the picture box
End Sub
Sub Grow(Txt As String, MaxSize As Integer, MinSize As Integer, Delay As String, PicBox As PictureBox)
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
PicBox.FontSize = MinSize 'Set the size of the font to the minium that the user specified
Do 'Start do
DoEvents
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
PicBox.Cls 'Clear picture box
PicBox.FontSize = PicBox.FontSize + 1 'Makes the font size grow, hence the sub name Grow
PicBox.CurrentX = PicBox.ScaleWidth / 2 - PicBox.TextWidth(Txt) / 2 'Set the X axis to the middle
PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Set the Y axis to the middle
PicBox.Print Txt$ 'Show the text after everything has been set
Loop Until PicBox.FontSize >= MaxSize 'If the size of the font is at or above the maximum, then stop looping
End Sub
Sub Shrink(Txt As String, MaxSize As Integer, MinSize As Integer, Delay As String, PicBox As PictureBox)
PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
PicBox.FontSize = MaxSize 'Set the size of the font to the maximum that the user specified
Do 'Start do
DoEvents
Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
PicBox.Cls 'Clear picture box
PicBox.FontSize = PicBox.FontSize - 1 'Makes the font size shrink, hence the sub name Shrink
PicBox.CurrentX = PicBox.ScaleWidth / 2 - PicBox.TextWidth(Txt) / 2 'Set the X axis to the middle
PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Set the Y axis to the middle
PicBox.Print Txt$ 'Show the text after everything has been set
Loop Until PicBox.FontSize <= MinSize 'IF the size of the font is at or below the minium, then stop looping
End Sub